﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Entity;
using BLL;


namespace BookStore.Controllers
{
    public class PayController : Controller
    {
        //
        // GET: /Pay/
        //订单页面
        public ActionResult pay()
        {
            //ViewBag.save = T_BOrder.Save();
            return View();
        }

        //获取省份信息
        public JsonResult GetProvincelist()
        {
            List<Area> save = T_BOrder.Save();//获取省份      
            return Json(save,JsonRequestBehavior.AllowGet);
        }
        //根据省份ID获取城市
        public JsonResult GetCitylist(string pid)
        {
            List<Area> City = T_BOrder.City(pid);//获取省份
            return Json(City, JsonRequestBehavior.AllowGet);
        }


        //获取区县
        public JsonResult GetCountylist(string cid)
        {
            List<Area> County = T_BOrder.County(cid);//获取省份
            return Json(County, JsonRequestBehavior.AllowGet);
        }

        //新增地址
        [HttpPost]
        public ActionResult pay(ShoppingAddress sad)
        {
            sad.UserID = Convert.ToInt32(Request.Cookies["User"].Values["UserId"]);
            T_BOrder.AddAddress(sad);
            return Content("<script>alert('添加成功！');history.go(-1);;</script>");
        }

    }
}
